#!/bin/bash

longestusername=0
shortestusername=1000

for username in `grep -v '^#' /etc/passwd | cut -d ':' -f1`
do
  length=${#username}

  if (( length < shortestusername ))
  then
    shortest=$username
    shortestusername=$length
  elif (( length > longestusername ))
  then
    longest=$username
    longestusername=$length
  fi
done

echo The shortest username is $shortest and the longest is $longest.
